package enemies 
{
	/**
	 * ...
	 * @author Excel Excel
	 */
	import flash.display.*;
	import flash.geom.ColorTransform;
	import flash.events.*;
	import flash.media.Sound;
	import emb.SoundLib;

	public class Mine extends Follower
	{
		public var detected:Boolean;
		
		public function Detect()
		{
			detected = true;
			Draw();
		}
		
		public function Mine(stage: Stage, t: Player) 
		{
			detected = false;
			super(stage, t, 0.0);
			
			MaskInteract = GroupPlayer | GroupEnemy | GroupJunk;
			MaskCollide = 0;
			MaskPublic = 0;//Since player collides with 1 set 2 - so it wouldn't 
		//	trace("mine's ready!");
		    //removeEventListener(Event.ENTER_FRAME, movePlayer);//Mine is not a follower (It doesn't help!?)
			
		}
		
		override public function Interact(o:MovingCircle):Boolean
		{
			if (super.Interact(o))
			{
				var pl:Player = o as Player;
				if (pl && !pl.posesses)
				{
					this.Damage(0xf1c1)
					pl.AmmoMines++;
					SoundLib.Instance().PlaySound(x,y,SoundLib.SPickUp);
					removeMe = true;
					return true;
				}
				SoundLib.Instance().PlaySound(x,y,SoundLib.SBlowUp);
				//trace("Kaboom!");
				o.Damage(60);
				o.brainDead = true;
				MaskInteract = 0;//Never more
				this.Damage(0xf1c1);
				return true;
			}
			return false;
		}
		
		override protected function Draw():void
		{
			graphics.clear();
			if (detected)
			{
				graphics.beginFill(0xFF7700);
				graphics.drawCircle(0, 0, r); //
				graphics.beginFill(0xFFAA11);
				graphics.drawRect(-r/2, -r/2, r, r);
				graphics.endFill();
				ColorMeIfImDead();
			}
		}
		
		override public function movePlayer(event:Event):void
		{}
		
		override public function moveForward():void
		{}
	}
}